Socket
Socket
Sign inDemoInstall

@nextgis/properties-filter

Package Overview
Dependencies
2
Maintainers
3
Versions
78
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nextgis/properties-filter

Filtering objects by its properties using expressions


Version published
Maintainers
3
Created

Changelog

Source

1.19.0 (2023-11-24)

Features

  • ngw-connector: add legend symbol response interface (fbbd3c3)
  • ngw-kit: implement legend for raster layer (91ca2e5)
  • ngw-kit: implement legend for webmap (c8b904d)
  • webmap: implement legend methods (6049ef8)

Readme

Source

Properties Filter

size version

An auxiliary library that allows filtering objects by its properties using JSON-serializable expressions

Installation

# latest stable
$ npm install --save-dev @nextgis/properties-filter
# or
$ yarn add @nextgis/properties-filter

Usage

General view of expression

[ С , [E1] , [E2] , [EN] ]

  • С - condition (optional). May be 'all' or 'any';

  • E - expression:

    [key, operator, value]

    • key - property name;
    • operator - gt, lt, ge, le, eq, ne, in, notin, like, ilike;
    • value - anything to compare with property by operator

    in and notin:

    • [['id', 'in', [1,2,3]], ['id', 'notin', [1,2,3]]]

    like and ilike:

    Place %-character after or before key string to determine the direction of search.

    • ['str%', 'like', 'hello']
    • ['%str%', 'ilike', 'Worl']

Nesting

[ [E1], ['any', [E2], [E3, E4] ], ['any', [E5], [E6] ] ] ]

Example

import { propertiesFilter, featureFilter } from '@nextgis/properties-filter';

const properties = {
  place: 'Tofalaria',
  area: 21,
};

propertiesFilter(properties, [['place', 'eq', 'Tofalaria']]); // true
propertiesFilter(properties, [['place', 'in', ['Tofalaria', 'Siberia']]]); // true
propertiesFilter(properties, [['place%', 'like', 'Tof']]); // true

propertiesFilter(properties, [
  // 'and', // - by default
  ['place', 'eq', 'Tofalaria'],
  ['area', 'ge', 21],
]); // true
propertiesFilter(properties, [
  'any',
  ['place', 'eq', 'Siberia'],
  ['area', 'gt', 10],
]); // true

Commercial support

Need to fix a bug or add a feature to @nextgis/properties-filter? We provide custom development and support for this software. Contact us to discuss options!

http://nextgis.com

Keywords

FAQs

Last updated on 24 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc